feat: implement global error pages (404 and 500)#242
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements branded global error pages in the Angular frontend and updates routing/interception so unknown routes show a 404 screen and backend 5xx responses can redirect users to a 500 error screen, aligning behavior with issue #113.
Changes:
- Added standalone 404 (
NotFoundComponent) and 500 (ServerErrorComponent) pages with shared global styling. - Updated routing to render the 404 page on the wildcard
**route and added explicit/errorand/not-foundroutes. - Updated
token.interceptor.tsto navigate to/erroron server-side (5xx) failures while excluding selected background endpoints.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/styles.scss | Adds shared global styles for the error pages (theme-variable based). |
| frontend/src/app/pages/server-error/server-error.component.ts | Introduces the 500 error page component. |
| frontend/src/app/pages/server-error/server-error.component.html | 500 error page markup (icon, message, “Go Home” link). |
| frontend/src/app/pages/not-found/not-found.component.ts | Introduces the 404 error page component. |
| frontend/src/app/pages/not-found/not-found.component.html | 404 error page markup (icon, message, “Go Home” link). |
| frontend/src/app/core/interceptors/token.interceptor.ts | Redirects to /error on 5xx responses (with endpoint exclusions). |
| frontend/src/app/app.routes.ts | Adds /error, /not-found, and routes ** to the 404 component. |
| frontend/src/app/app.component.ts | Expands navbar-hiding logic to include error routes. |
| backend/src/main/resources/application.properties | Adds a trailing newline (no functional change). |
| .gitattributes | Adds LF normalization and binary patterns for consistent line endings across platforms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use route data (hideNavbar) instead of URL string matching for navbar visibility, so wildcard (**) 404 routes correctly hide the navbar - Fix isExcludedFromErrorPage to match '/devices' without trailing slash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NotFoundComponentandServerErrorComponentmatching the app's theme (Dark/Light mode supported)**route to the 404 page (replaced the silent redirect to/login)token.interceptor.tsto catch 5xx errors and route to/error. Explicitly excluded background endpoints like/auth/refreshand/devices/to prevent redirect loopsstyles.scssto keep the code DRYLinked issue
Closes #113
How to test
/blah) → should show the 404 page/auth/refresh)Notes / Risk
Low risk. Changes are isolated to routing and the HTTP interceptor. Background auth/refresh endpoints are explicitly excluded from the 5xx redirect logic to prevent loops.